﻿/*
Copyright (c) 2010, hiSoft
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the hiSoft nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE HISOFT AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL HISOFT BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Orchard.Test.Library;
using Selenium;

namespace orchard.test.modules.widgets.auto
{
    [TestClass]
    public class AddLayerWithLogicalIdentifierinRule
    {
        private TestLibrary TestLibrary;
        private ISelenium selenium;

        [TestInitialize]
        public void SetupTest()
        {
            TestLibrary = TestLibrary.SetupTest(this.ToString());
            selenium = TestLibrary.Selenium;
        }

        [TestCleanup]
        public void TeardownTest()
        {
            TestLibrary.ShutDown();
        }
        //private string errormessage = ""; 
        private string addLayerMsg = "Your Layer has been created";
        private string addWidgetMsg = "Your Html Widget has been added";
        //private delegate string DoAssert();
        //private void DoAssert(assert.istrue())
        //{
        //    try
        //    {
        //        assert.istrue(selenium.IsTextPresent(addLayerMsg));
        //    }
        //    catch (exception ex)
        //    { 
        //        errormsg += ex.innerexception.tostring();
        //        return errormsg;
        //    }
        //    return "";
        //}

        [TestMethod]
        public void Widget_AddLayerWithLogicalIdentifierinRule()
        {
            string errorMessage = "";
            string user = TestLibrary.Consts.AdminUserName;
            string widgetpartlocator = "Widgets/EditWidget/";

            try
            {
                TestLibrary.UserHelper.LogOnAsAdmin();

                #region add some layers
                var layer = TestLibrary.WidgetHelper.AddWidgetLayer("layer001", user, "this is layer1", "url ('~/default*') and !authenticated");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer02 = TestLibrary.WidgetHelper.AddWidgetLayer("layer002", user, "this is layer02", "url ('~/home*') || authenticated");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer03 = TestLibrary.WidgetHelper.AddWidgetLayer("layer003", user, "this is layer03", "url ('~/default*') && authenticated");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));

                var layer04 = TestLibrary.WidgetHelper.AddWidgetLayer("layer004", user, "this is layer04", " url ('~/default*') || url('~/home*') && 123==123");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer05 = TestLibrary.WidgetHelper.AddWidgetLayer("layer005", user, "this is layer05", " url ('~/default*' && '~/home*') && 123>122");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer06 = TestLibrary.WidgetHelper.AddWidgetLayer("layer006", user, "this is layer06", " url ('~/default*','~/home*') && 123<122");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer07 = TestLibrary.WidgetHelper.AddWidgetLayer("layer007", user, "this is layer07", " url ('~/default*','~/home*') && 123>=122");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer08 = TestLibrary.WidgetHelper.AddWidgetLayer("layer008", user, "this is layer08", " url ('~/default*','~/home*') && 123<=122");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));

                var layer09 = TestLibrary.WidgetHelper.AddWidgetLayer("layer009", user, "this is layer09", " url ('~/default*') && 2==1*2");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer10 = TestLibrary.WidgetHelper.AddWidgetLayer("layer010", user, "this is layer10", " url ('~/default*') && 2==2*2");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer11 = TestLibrary.WidgetHelper.AddWidgetLayer("layer011", user, "this is layer11", " url ('~/default*') && 2==4/2");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer12 = TestLibrary.WidgetHelper.AddWidgetLayer("layer012", user, "this is layer12", " url ('~/default*') && 2==4/4");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer17 = TestLibrary.WidgetHelper.AddWidgetLayer("layer017", user, "this is layer17", " url ('~/default*') && 'a'=='a'");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer18 = TestLibrary.WidgetHelper.AddWidgetLayer("layer018", user, "this is layer18", " url ('~/default*') && '\\\\'=='\\\\'"); //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer19 = TestLibrary.WidgetHelper.AddWidgetLayer("layer019", user, "this is layer19", " url ('~/default*') && '_'=='_'"); //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer20 = TestLibrary.WidgetHelper.AddWidgetLayer("layer020", user, "this is layer20", " url ('~/default*') && '_+s'=='_+s'"); //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer21 = TestLibrary.WidgetHelper.AddWidgetLayer("layer021", user, "this is layer21", " url ('~/default*') && '16'==16");  //false


                var layer13 = TestLibrary.WidgetHelper.AddWidgetLayer("layer013", user, "this is layer13", " url ('~/default*') && 2==1+1");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer14 = TestLibrary.WidgetHelper.AddWidgetLayer("layer014", user, "this is layer14", " url ('~/default*') && 2==1-1");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer15 = TestLibrary.WidgetHelper.AddWidgetLayer("layer015", user, "this is layer15", " url ('~/default*') && 2>=(1+1)*2");
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer16 = TestLibrary.WidgetHelper.AddWidgetLayer("layer016", user, "this is layer16", " url ('~/default*') && 2<=(2+2)/1");

                var layer22 = TestLibrary.WidgetHelper.AddWidgetLayer("layer022", user, "this is layer22", " url ('~/default*') && 10>1/923456789");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer23 = TestLibrary.WidgetHelper.AddWidgetLayer("layer023", user, "this is layer23", " url ('~/default*') && 10>1/923456789/123456789");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer24 = TestLibrary.WidgetHelper.AddWidgetLayer("layer024", user, "this is layer24", " url ('~/default*') && 10>1/(12345678+100000)");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer25 = TestLibrary.WidgetHelper.AddWidgetLayer("layer025", user, "this is layer25", " url ('~/default*') && 1>0 && false");  //false
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer26 = TestLibrary.WidgetHelper.AddWidgetLayer("layer026", user, "this is layer26", " url ('~/default*') && 1>0 && true");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer27 = TestLibrary.WidgetHelper.AddWidgetLayer("layer027", user, "this is layer27", " url ('~/default*') && !false");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer28 = TestLibrary.WidgetHelper.AddWidgetLayer("layer028", user, "this is layer28", " url ('~/default*') && !!false");  //false
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer29 = TestLibrary.WidgetHelper.AddWidgetLayer("layer029", user, "this is layer29", " url ('~/default*') && 2!=3");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer30 = TestLibrary.WidgetHelper.AddWidgetLayer("layer030", user, "this is layer30", " url ('~/default*') && 2!=2");  //false

                var layer31 = TestLibrary.WidgetHelper.AddWidgetLayer("layer031", user, "this is layer31", "url ('~/default*') &&  null!=123");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer32 = TestLibrary.WidgetHelper.AddWidgetLayer("layer032", user, "this is layer32", "url ('~/default*') &&  null==123");  //false
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer33 = TestLibrary.WidgetHelper.AddWidgetLayer("layer033", user, "this is layer33", "url ('~/default*') &&  nil == null");  //true
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer34 = TestLibrary.WidgetHelper.AddWidgetLayer("layer034", user, "this is layer34", "url ('~/default*') &&  nil != null");  //false  
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                var layer35 = TestLibrary.WidgetHelper.AddWidgetLayer("layer035", user, "this is layer35", "url ('~/default*') &&  str");  //false  
                Assert.IsTrue(selenium.IsTextPresent(addLayerMsg));
                #endregion

                var homepage1 = TestLibrary.PageHelper.CreatePage(new PageSettings { Title = "homepage1", Permalink = "homepage1", PublishSetting = PublishSettings.PublishNow });

                #region add widget for above added layers
                //widget01 will display on default* page and when not login
                var widget01 = TestLibrary.WidgetHelper.AddHtmlWidget(layer, WidgetZone.Header, "widget4layer", 1, user, "widget01 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget02 = TestLibrary.WidgetHelper.AddHtmlWidget(layer02, WidgetZone.Header, "widget4layer02", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget03 = TestLibrary.WidgetHelper.AddHtmlWidget(layer03, WidgetZone.Header, "widget4layer03", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget04 = TestLibrary.WidgetHelper.AddHtmlWidget(layer04, WidgetZone.Header, "widget4layer04", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget05 = TestLibrary.WidgetHelper.AddHtmlWidget(layer05, WidgetZone.Header, "widget4layer05", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget06 = TestLibrary.WidgetHelper.AddHtmlWidget(layer06, WidgetZone.Header, "widget4layer06", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget07 = TestLibrary.WidgetHelper.AddHtmlWidget(layer07, WidgetZone.Header, "widget4layer07", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget08 = TestLibrary.WidgetHelper.AddHtmlWidget(layer08, WidgetZone.Header, "widget4layer08", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget09 = TestLibrary.WidgetHelper.AddHtmlWidget(layer09, WidgetZone.Header, "widget4layer09", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget10 = TestLibrary.WidgetHelper.AddHtmlWidget(layer10, WidgetZone.Header, "widget4layer10", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget11 = TestLibrary.WidgetHelper.AddHtmlWidget(layer11, WidgetZone.Header, "widget4layer11", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget12 = TestLibrary.WidgetHelper.AddHtmlWidget(layer12, WidgetZone.Header, "widget4layer12", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget13 = TestLibrary.WidgetHelper.AddHtmlWidget(layer13, WidgetZone.Header, "widget4layer13", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget14 = TestLibrary.WidgetHelper.AddHtmlWidget(layer14, WidgetZone.Header, "widget4layer14", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget15 = TestLibrary.WidgetHelper.AddHtmlWidget(layer15, WidgetZone.Header, "widget4layer15", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget16 = TestLibrary.WidgetHelper.AddHtmlWidget(layer16, WidgetZone.Header, "widget4layer16", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget17 = TestLibrary.WidgetHelper.AddHtmlWidget(layer17, WidgetZone.Header, "widget4layer17", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget18 = TestLibrary.WidgetHelper.AddHtmlWidget(layer18, WidgetZone.Header, "widget4layer18", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget19 = TestLibrary.WidgetHelper.AddHtmlWidget(layer19, WidgetZone.Header, "widget4layer19", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget20 = TestLibrary.WidgetHelper.AddHtmlWidget(layer20, WidgetZone.Header, "widget4layer20", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget21 = TestLibrary.WidgetHelper.AddHtmlWidget(layer21, WidgetZone.Header, "widget4layer21", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget22 = TestLibrary.WidgetHelper.AddHtmlWidget(layer22, WidgetZone.Header, "widget4layer22", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget23 = TestLibrary.WidgetHelper.AddHtmlWidget(layer23, WidgetZone.Header, "widget4layer23", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget24 = TestLibrary.WidgetHelper.AddHtmlWidget(layer24, WidgetZone.Header, "widget4layer24", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget25 = TestLibrary.WidgetHelper.AddHtmlWidget(layer25, WidgetZone.Header, "widget4layer25", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget26 = TestLibrary.WidgetHelper.AddHtmlWidget(layer26, WidgetZone.Header, "widget4layer26", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget27 = TestLibrary.WidgetHelper.AddHtmlWidget(layer27, WidgetZone.Header, "widget4layer27", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget28 = TestLibrary.WidgetHelper.AddHtmlWidget(layer28, WidgetZone.Header, "widget4layer28", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget29 = TestLibrary.WidgetHelper.AddHtmlWidget(layer29, WidgetZone.Header, "widget4layer29", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget30 = TestLibrary.WidgetHelper.AddHtmlWidget(layer30, WidgetZone.Header, "widget4layer30", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget31 = TestLibrary.WidgetHelper.AddHtmlWidget(layer31, WidgetZone.Header, "widget4layer31", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget32 = TestLibrary.WidgetHelper.AddHtmlWidget(layer32, WidgetZone.Header, "widget4layer32", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget33 = TestLibrary.WidgetHelper.AddHtmlWidget(layer33, WidgetZone.Header, "widget4layer33", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget34 = TestLibrary.WidgetHelper.AddHtmlWidget(layer34, WidgetZone.Header, "widget4layer34", 1, user, "widget02 for layer which rule with logicalidentifier");
                Assert.IsTrue(selenium.IsTextPresent(addWidgetMsg));
                var widget35 = TestLibrary.WidgetHelper.AddHtmlWidget(layer35, WidgetZone.Header, "widget4layer35", 1, user, "widget35 for layer which rule with logicalidentifier");
                #endregion

                selenium.Open("/default-test-page");

                #region assert if specail widget display correctly on special page
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget01.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget02.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget03.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget04.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget05.Id));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget06.Id));
                Assert.IsTrue(selenium.GetHtmlSource().Contains(widgetpartlocator + widget07.Id));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget08.Id));
              
                Assert.IsTrue(selenium.IsTextPresent(widget09.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget10.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget11.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget12.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget13.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget14.Id));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget15.Id));

                Assert.IsTrue(selenium.IsTextPresent(widget16.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget17.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget18.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget19.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget20.Title));

                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget21.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget22.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget23.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget24.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget25.Id));

                Assert.IsTrue(selenium.IsTextPresent(widget26.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget27.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget28.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget29.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget30.Id));

                Assert.IsTrue(selenium.IsTextPresent(widget31.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget32.Id));
                Assert.IsTrue(selenium.IsTextPresent(widget33.Title));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget34.Id));
                Assert.IsFalse(selenium.GetHtmlSource().Contains(widgetpartlocator + widget35.Id));
                #endregion

                TestLibrary.UserHelper.LogOff();
                selenium.Open("/homepage1");
                #region assert if widgets display correctly
                Assert.IsTrue(selenium.IsTextPresent(widget02.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget04.Title));
                Assert.IsTrue(selenium.IsTextPresent(widget05.Title));
               
                #endregion

                selenium.Open("/default-test-page");
                #region assert if widgets display correctly
                Assert.IsTrue(selenium.IsTextPresent(widget01.Title));          
                #endregion

            }
            catch (Exception ex)
            { errorMessage += ex.ToString(); }
            finally
            {
                if (errorMessage.Length > 1)
                    Assert.IsTrue(false, errorMessage);
            }
        }
    }
}
